package com.geeguo.ebuilder.client.business.system.permission.model;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;

import java.util.ArrayList;
import java.util.List;

@Getter
@Setter
@JsonInclude(JsonInclude.Include.NON_NULL)
public class WebMenuVO {

	@JsonIgnore
	private String parentId;
	@Schema(title = "名称")
	private String name;
	@Schema(title = "访问路径")
	private String path;
	@Schema(title = "组件")
	private String component;
	@Schema(title = "元数据")
	private WebMenuMetaVO meta;
	@Schema(title = "子菜单")
	private List<WebMenuVO> children;

	public void addChild(WebMenuVO child) {
		if (children == null) {
			children = new ArrayList<>();
		}
		children.add(child);
	}
}